﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using Shutterstock.Salesforce.Tools.SFPartner;
using Shutterstock.Salesforce.Tools;
namespace Shutterstock.Salesforce.SSISDownload
{
    /// <summary>
    /// Parameters
    /// </summary>
    public class ReplicationParameter
    {
        
        
        public string DestConnectionString { get; set; }
        

        public ISalesForceConnection SalesForceConnection{ get; set; }
        
        /// <summary>
        /// Salesforce table info
        /// </summary>
        public SFTableInfo SFTableInfo { get; set; }
        /// <summary>
        /// The BatchSize fot the bulkCopy
        /// </summary>
        public int BatchSize { get; set; }
        /// <summary>
        /// Keep INdexes
        /// </summary>
        public bool MaintainIndexes { get; set; }
        /// <summary>
        /// Keep Permissions
        /// </summary>
        public bool MaintainPermissions { get; set; }
        /// <summary>
        /// Whether do manual comparison for deletion.
        /// </summary>
        public bool ManualComparison { get; set; }
        
        /// <summary>
        /// Whether to use the Bulk API above the cutoff number
        /// </summary>
        public bool UseBulkAPI { get; set; }

        /// <summary>
        /// Cutoff number for Using the Bulk Api
        /// </summary>
        public int BulkRowCutoff{ get; set; }

        /// <summary>
        /// Get/Set the folder path to store temp files
        /// </summary>
        public string BulkPath { get; set; }
        /// <summary>
        /// Wait Handle
        /// </summary>
        public AutoResetEvent WaitHandle { get; set; }
        
        public DmlEmailParameter EmailParameters {get;set;}

        /// <summary>
        /// Initializes a new instance of the replicationParameter class
        /// </summary>
        /// <param name="destConnectionString">destination sql connection string</param>
        /// <param name="sFUserName">salesforce user name</param>
        /// <param name="sFPassword">salesforce password</param>
        /// <param name="sFTableInfo">salesforce table info</param>
        /// <param name="batchSize">the batch size for the bulk copy</param>
        /// <param name="maintainIndexes">whether to keep the indexes on the table</param>
        /// <param name="maintainPermissions">whether to keep the same permissioins on the table</param>
        /// <param name="manualComparison">whether to do the manual comparsion for deletion</param>
        public ReplicationParameter(string destConnectionString
            , ISalesForceConnection sfConnection, SFTableInfo sFTableInfo, int batchSize, bool maintainIndexes, bool maintainPermissions, bool manualComparison
            , bool useBulk
            , int bulkCutoff
            , string bulkPath
            , DmlEmailParameter emailParameter
            )
        {
            DestConnectionString = destConnectionString;
            SalesForceConnection = sfConnection;
            SFTableInfo = sFTableInfo;
            BatchSize = batchSize;
            MaintainIndexes = maintainIndexes;
            MaintainPermissions = maintainPermissions;
            ManualComparison = manualComparison;
            UseBulkAPI = useBulk;
            BulkRowCutoff = bulkCutoff;
            BulkPath = bulkPath;
            WaitHandle = new AutoResetEvent(false);
            EmailParameters = emailParameter;
        }

    }
}
